;; (setq debug-on-error t)

(setq user-full-name "zephyr")
(setq user-mail-address "liuzf1986@163.com")
;; color theme
(load-theme 'tango-dark)
(ansi-color-for-comint-mode-on)
;; show current time
(display-time-mode t)
(setq display-time-day-and-date t)
(setq display-time-24hr-format t)
(setq display-time-use-mail-icon t)
(setq display-time-interval 10)
;; line space
(setq default-line-spacing 1)
(setq default-fill-column 120)
;; default major mode
(setq default-major-mode 'text-mode)
;; kill ring length
(setq kill-ring-max 200)
;; syntax highlight
(global-font-lock-mode t) 
;; highlight selection region
(transient-mark-mode t)
;; default highlight
;;(global-hl-line-mode nil)
(setq-default indicate-empty-lines t)
(show-paren-mode t)
(setq show-paren-style 'parentheses)
;; share clipboard
(setq x-select-enable-clipboard t)
;; inhibit startup message
(setq inhibit-startup-message t)
;; cursor
(set-cursor-color "Red")
;; tab
;;(setq indent-tabs-mode nil)
(setq c-default-style "linux"
      c-basic-offset 2
	  indent-tabs-mode 1
	  default-tab-width 2
	  tab-width 2
	  tab-stop-list ())
;; disable toolbar
(tool-bar-mode -1)
;(menu-bar-mode -1)
;; disable bell
(setq visible-bell t)
;; replace y and n for yes or no
(fset 'yes-or-no-p 'y-or-n-p)
;; disable backup file
(setq make-backup-files nil)
;; title bar
(setq-default frame-title-format "[ %b ] %f")
;; scroll interval
;(global-set-key [mouse-4] (lambda () (interactive) (scroll-down 3)))
;(global-set-key [mouse-5] (lambda () (interactive) (scroll-up 3)))
;; xterm mouse
;; (xterm-mouse-mode)
;; maximize frame to fullscreen
;(custom-set-variables
; '(initial-frame-alist (quote ((fullscreen . maximized)))))

(defun custom-font()
  (set-frame-font "Cascadia Code:pixelsize=24" nil t)
  (dolist (charset '(kana han symbol cjk-misc bopomofo))
    (set-fontset-font (frame-parameter nil 'font)
		      charset
		      (font-spec :family "simsun" :size 24)))
  ;; (setq face-font-rescale-alist ‘(("monospace" . 1.0) ("WenQuanYi" . 1.23)))
  )
(add-to-list 'after-make-frame-functions
	     (lambda (new-frame)
	       (select-frame new-frame)
	       (if window-system (custom-font))))
(if window-system (custom-font))


;; Show line number
(setq line-number-mode t)
(global-linum-mode t)
;; (set-default-font "Source Code Pro 13")

;; Run server mode
(require 'server)
(if (and (fboundp 'server-running-p)
         (not (server-running-p)))
    (server-start))

;; Custom frame position
(add-to-list 'default-frame-alist '(top . 0))
(add-to-list 'default-frame-alist '(left . -1))
(add-to-list 'default-frame-alist '(width . 100))

;; Init package manager
(require 'package)
(setq package-enable-at-startup nil)
(setq package-archives '(("gnu"   . "http://elpa.emacs-china.org/gnu/")
                         ("melpa" . "http://elpa.emacs-china.org/melpa/")
			 ("melpa-stable" . "http://elpa.emacs-china.org/melpa-stable/")
			 ("Marmalade" . "http://elpa.emacs-china.org/marmalade/")))


(package-initialize)

(unless package-archive-contents
  (package-refresh-contents))

;; Initialize use-package on non-Linux platforms
(unless (package-installed-p 'use-package)
  (package-install 'use-package))
(setq use-package-always-ensure t)

(use-package autopair :init (autopair-global-mode))
(use-package yasnippet :init (yas-global-mode 1))

(require 'init-company)
(require 'init-org)
(require 'init-helm)
